// 封装个人中心相关接口
import request from '@/utils/request.js'

// 提交管理员个人信息
export const submitAdminInfoService = ({ id, phone, email, avatar }) => {
  return request({
    url: '/api/admin',
    method: 'PATCH',
    data: {
      id,
      phone,
      email,
      avatar
    }
  })
}

// 获取管理员的个人信息
export const getAdminInfoService = (id) => {
  return request({
    url: `/api/admin/${id}`,
    method: 'GET'
  })
}

// 修改密码
export const changeAdminPasswordService = ({
  id,
  oldPassword,
  newPassword
}) => {
  return request({
    url: `/api/admin/pwd/${id}`,
    method: 'PATCH',
    data: {
      oldPassword,
      newPassword
    }
  })
}
